package top.jolyoulu.corecommon.autoconfigure;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskBootStrap;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskProducer;
import top.jolyoulu.corecommon.queue.delayed.observer.DelayedTaskSubject;

/**
 * @Author: JolyouLu
 * @Date: 2024/2/4 17:06
 * @Description
 */
@Configuration
public class DelayedQueueAutoConfiguration {

    @Bean
    public DelayedTaskProducer delayedTaskProducer(){
        return new DelayedTaskProducer();
    }

    @Bean
    public DelayedTaskSubject delayedTaskSubject(){
        return new DelayedTaskSubject();
    }

    @Bean
    public DelayedTaskBootStrap delayedTaskConsumer(DelayedTaskProducer delayedTaskProducer, DelayedTaskSubject taskSubject){
        return new DelayedTaskBootStrap(1, delayedTaskProducer, taskSubject);
    }
}
